import java.util.Scanner;

public class Test4 {
    //4、银行ATM取款机系统，输入密码错误3次直接退出程序；输对密码进入取款，取得钱数必须是100的倍数，
    // 且一次不能取1000以上，取完后结束系统。
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int psw = 12345;
        out:
        for (int i = 0; i <= 3; i++) {
            System.out.println("请输入密码：");
            int password = in.nextInt();
            if (psw == password) {
                System.out.println("密码正确，请取款：");
                int money = in.nextInt();

                while (true) {
                    if (money % 100 == 0 && money <= 1000) {
                        System.out.println("你取出了" + money + "元");
                        System.out.println("交易结束！");
                        break out;
                    } else {
                        System.out.println("你输入的金额不符，请重新输入：");
                        money = in.nextInt();
                    }
                }
            }
            if (i == 3) {
                System.out.println("密码已锁定，请取出卡！");
            } else {
                System.out.println("密码错误，请重新输入，您还有" + (3 - i) + "次机会！");
            }
        }
    }
}


